/**
 * ---------------------------
 * Time: 2017/8/6 18:28.
 * Author: Cangshi
 * View: http://palerock.cn
 * ---------------------------
 */
define(['app', 'zepto'], function (app, $) {
    app.controller('statistics', function ($http, $scope, Device, ObjectUtils) {

        var init = function () {
            // $.showPreloader('正在获取统计信息...');
            // 获取所有的统计数据
            var statistics = Device.generateStatistics($scope.devices);
            // $.hidePreloader();
            if (statistics.length > 0) {
                $scope.totalStatistics = statistics.totalStatistics.statistics;
            }
        };
        init();

        $scope.enterSingleDevice = function (index) {
            $scope.thisDevice = $scope.devices[index].generateStatistics();
        }
    });
});